<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:converters="clr-namespace:DentalConfig.Converters;assembly=DentalConfig"
					xmlns:Config="clr-namespace:DentalConfig;assembly=DentalConfig">

    <!-- =============================================================================== -->
    <!-- Metro styled TreeView                                                           -->
    <!-- =============================================================================== -->

    <Style x:Key="ExpandCollapseToggleStyle"
           TargetType="{x:Type ToggleButton}">
        <Setter Property="Focusable" Value="False" />
        <Setter Property="Width" Value="16" />
        <Setter Property="Height" Value="16" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type ToggleButton}">
                    <Border Background="Transparent"
                            Height="16"
                            Padding="5,5,5,5"
                            Width="16">
                        <Path x:Name="ExpandPath"
                              Data="M0,0 L0,6 L6,0 z"
                              Fill="Transparent"
                              Stroke="{DynamicResource BlackBrush}">
                            <Path.RenderTransform>
                                <RotateTransform Angle="135"
                                                 CenterY="3"
                                                 CenterX="3" />
                            </Path.RenderTransform>
                        </Path>
                    </Border>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsChecked"
                                 Value="True">
                            <Setter Property="RenderTransform"
                                    TargetName="ExpandPath">
                                <Setter.Value>
                                    <RotateTransform Angle="180"
                                                     CenterY="3"
                                                     CenterX="3" />
                                </Setter.Value>
                            </Setter>
                            <Setter Property="Fill"
                                    TargetName="ExpandPath"
                                    Value="{DynamicResource GrayBrush1}" />
                            <Setter Property="Stroke"
                                    TargetName="ExpandPath"
                                    Value="{DynamicResource GrayBrush1}" />
                        </Trigger>
                        <Trigger Property="IsMouseOver"
                                 Value="True">
                            <Setter Property="Stroke"
                                    TargetName="ExpandPath"
                                    Value="{DynamicResource GrayBrush1}" />
                            <Setter Property="Fill"
                                    TargetName="ExpandPath"
                                    Value="{DynamicResource WhiteBrush}" />
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="TreeViewItemFocusVisual">
        <Setter Property="Control.Template">
            <Setter.Value>
                <ControlTemplate>
                        <Rectangle />
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style  x:Key="FileFilterSelectionTreeViewItem"
            TargetType="{x:Type TreeViewItem}">
        <Setter Property="MinHeight"
                Value="25" />
        <Setter Property="Background"
                Value="Transparent" />
        <Setter Property="FocusVisualStyle"
                Value="{StaticResource TreeViewItemFocusVisual}" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type TreeViewItem}">
                    <ControlTemplate.Resources>
                        <converters:TreeViewMarginConverter Length="12"
                                                            x:Key="LengthConverter" />
                    </ControlTemplate.Resources>
                    <DockPanel>
                        <Border x:Name="Border" DockPanel.Dock="Top"
                                Background="{TemplateBinding Background}"
                                BorderBrush="{TemplateBinding BorderBrush}"
                                BorderThickness="{TemplateBinding BorderThickness}"
                                Padding="{TemplateBinding Padding}"
                                MinHeight="{TemplateBinding MinHeight}">
                            <DockPanel Margin="{Binding Converter={StaticResource LengthConverter}, RelativeSource={x:Static RelativeSource.TemplatedParent}}"
                                  VerticalAlignment="Stretch"  DockPanel.Dock="Top">
                                <ToggleButton x:Name="Expander" DockPanel.Dock="Left"
                                              Style="{StaticResource ExpandCollapseToggleStyle}"
                                              IsChecked="{Binding Path=IsExpanded, RelativeSource={x:Static RelativeSource.TemplatedParent}, Mode=TwoWay}"
                                              ClickMode="Press" />

                                <ContentPresenter x:Name="PART_Header" DockPanel.Dock="Left"
                                                  Grid.Column="1"
                                                  ContentSource="Header"
                                                  HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                                                  VerticalAlignment="{TemplateBinding VerticalContentAlignment}" />
                            </DockPanel>
                        </Border>
                        <ItemsPresenter x:Name="ItemsHost"  DockPanel.Dock="Top">
                            <ItemsPresenter.LayoutTransform>
                                <ScaleTransform ScaleY="1" />
                            </ItemsPresenter.LayoutTransform>
                        </ItemsPresenter>
                    </DockPanel>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsExpanded"
                                 Value="False">
                            <Setter TargetName="ItemsHost"
                                    Property="Visibility"
                                    Value="Collapsed"></Setter>
                        </Trigger>

                        <Trigger Property="HasItems"
                                 Value="False">
                            <Setter TargetName="Expander"
                                    Property="Visibility"
                                    Value="Hidden" />
                        </Trigger>

                        <Trigger Property="IsEnabled"
                                 Value="False">
                            <Setter Property="Foreground"
                                    Value="{DynamicResource GrayBrush7}" />
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="FileFilterSelectionTreeView"
           TargetType="{x:Type TreeView}">
        <Setter Property="BorderBrush"
                Value="Transparent" />
		<Setter Property="Config:TouchScrollEncountersBoundaryAnimationBehavior.SuppressEncountersBoundaryAnimation" Value="True"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type TreeView}">
<ScrollViewer CanContentScroll="False" HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="{TemplateBinding ScrollViewer.VerticalScrollBarVisibility}" Background="{TemplateBinding Panel.Background}" Padding="{TemplateBinding Control.Padding}" Name="_tv_scrollviewer_" SnapsToDevicePixels="{TemplateBinding UIElement.SnapsToDevicePixels}" Focusable="False">
                        <ItemsPresenter />
</ScrollViewer>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
        <Setter Property="ItemContainerStyle"
                Value="{StaticResource FileFilterSelectionTreeViewItem}" />
    </Style>

</ResourceDictionary>